package com.supermap.business.deviceInfo;

import com.alibaba.dubbo.config.annotation.Reference;
import com.supermap.dataservice.util.JSONUtil;
import com.supermap.dubbo.api.deviceinfo.AgriculturalParkService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletResponse;

/**
 * @Author:langhongshuai
 * @Description:农业园区接口层(内蒙数据库)
 * @Date:18/5/19 下午11:37
 */
@Controller
@RequestMapping("AgriculturalParkController")
public class AgriculturalParkController {

    /**
     * 使用指定类初始化日志对象，在日志输出的时候，可以打印出日志信息所在类
     */
    protected static final Logger logger = LoggerFactory.getLogger(AgriculturalParkController.class);


    @Reference
    private AgriculturalParkService agriculturalParkService;

    /**
     * 获取所有的农业园区信息
     */
    @RequestMapping("/getAllAgriculturalPark")
    @ResponseBody
    public JSONUtil getAllAgriculturalPark(HttpServletResponse response) {
        response.setHeader("Access-Control-Allow-Origin", "*");
        response.setHeader("Access-Control-Allow-Methods", "POST,GET,OPTIONS,DELETE");
        response.setHeader("Access-Control-Max-Age", "1800");
        return agriculturalParkService.getAllAgriculturalPark();
    }


}
